package com.hue.gulimail.gulimailsearch.web;

import com.hue.gulimail.gulimailsearch.service.SearchService;
import com.hue.gulimail.gulimailsearch.vo.Param;
import com.hue.gulimail.gulimailsearch.vo.SearchResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @author 姚凤桥
 */
@Controller
public class IndexController {
    @Autowired
    private SearchService searchService;

    @RequestMapping({"/", "/list.html"})
    public String index(Param param, Model model) {
        SearchResult searchResult = searchService.search(param);
        model.addAttribute("result",searchResult);
        return "list";
    }

}
